﻿using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Text;

namespace JieKou.Modbus
{
    public class ParameterTCP
    {

        #region 属性封装
        private string _modbusName = "未命名的Modbus";
        private string _remoteIP = "127.0.0.1";
        private int _remotePort = 502;
        private byte _remoteID = 1;
        private int _modbusTimeOut = 1000;
        private int _functioncode = 4;

        /// <summary>
        /// 索引号
        /// </summary>
        public int Index { get; set; }
        /// <summary>
        /// 是否是连续的读取，即整体读取。
        /// 当前模式是非连续，现在想把连续读取的形式也加入进来。
        /// 2023年6月7日09:29:52
        /// </summary>
        public bool IsContinuously { get; set; } = false;   //TODO: 这里很重呀 2023年6月7日16:26:38 根据情况做变动

        /// <summary>
        /// 协议名称
        /// </summary>
        [DataMember]
        public string ModbusName { get => _modbusName; set => _modbusName = value; }
        /// <summary>
        /// modbusIP
        /// </summary>
        [DataMember]
        public string RemoteIP { get => _remoteIP; set => _remoteIP = value; }
        /// <summary>
        /// modbus端口，默认502
        /// </summary>
        [DataMember]
        public int RemotePort { get => _remotePort; set => _remotePort = value; }
        /// <summary>
        /// 远程modbusID
        /// </summary>
        [DataMember]
        public byte RemoteID { get => _remoteID; set => _remoteID = value; }
        /// <summary>
        /// 超时设定值
        /// </summary>
        [DataMember]
        public int ModbusTimeOut { get => _modbusTimeOut; set => _modbusTimeOut = value; }
        /// <summary>
        /// 功能码
        /// </summary>
        [DataMember]
        public int Functioncode { get => _functioncode; set => _functioncode = value; }
        #endregion

    }
}
